Added socket keepalive#10
Conversation
|
Thank you for contributing to this project. I'll test, merge, and push update to NPM soonest. |
|
Hi @si-hb, I've tested the changes and it looks like reconnect is working but several other issues are introduced.
I think we can build on your work but I fear publishing it as is will add to the issues list. |
Core improvements: - Fix socket timeout issue by reducing NoOp interval from 30s to 15s - Cap exponential reconnection backoff at 60 seconds (was ~4.3 minutes) - Fix child nodes not updating status after reconnection - Ensure data/connect handlers attached to all sockets (initial and reconnected) - Add proper cleanup of NoOp intervals before starting new ones Connection state improvements: - Change logging from trace() to log() for visibility - Add state change events (connected/connecting/disconnected/error) emitted to child nodes - Update child nodes to listen to server events instead of socket events directly - Fix node status updates on reconnection (now shows green dot when reconnected) Reconnection logic: - Exponential backoff: 1s, 2s, 4s, 8s, 16s, 32s, 60s (capped) - Log suppression after 6 failed attempts to prevent flooding - Continue reconnecting indefinitely at 60s intervals - Reset attempts counter on successful connection Testing additions: - Add test_mixer.json flow for Mixer4x2 controls testing - Configure for 192.168.1.191 with logCommunications disabled by default Bug fixes: - Fix socket timeout race condition (NoOp vs socket timeout timing) - Fix multiple NoOp intervals running after reconnection - Fix data handler not attached to reconnected sockets - Fix child nodes stuck in error state after reconnection
|
Any news, please? I still have a problem in my cinema where ESPHome display is blind (dark) until I move any node by 1px and re-deploy NodeRed. |
|
Hi. have tried to use this PR, but unfortunately it caused my NodeRED runtime to crash: I think it's because of I don't think there is an upstream handler for this (by design), so it crashes nodeRED. I haven't written a nodeRED module before, but from a brief bit of reading, I think errors should be emitted using the API |
Nice work on these modules, thank you.
We found that updating the DSP file would break the connection permanently until the flows were restarted. Added socket keepalive and timeout handling so the module reconnects on its own if the DSP is updated.
Tested as working in a live environment.